package edu.bjtu.supplychain.contract;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.fisco.bcos.sdk.abi.FunctionReturnDecoder;
import org.fisco.bcos.sdk.abi.TypeReference;
import org.fisco.bcos.sdk.abi.datatypes.Event;
import org.fisco.bcos.sdk.abi.datatypes.Function;
import org.fisco.bcos.sdk.abi.datatypes.Type;
import org.fisco.bcos.sdk.abi.datatypes.Utf8String;
import org.fisco.bcos.sdk.abi.datatypes.generated.Int256;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple1;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple4;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple5;
import org.fisco.bcos.sdk.client.Client;
import org.fisco.bcos.sdk.contract.Contract;
import org.fisco.bcos.sdk.crypto.CryptoSuite;
import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.eventsub.EventCallback;
import org.fisco.bcos.sdk.model.CryptoType;
import org.fisco.bcos.sdk.model.TransactionReceipt;
import org.fisco.bcos.sdk.model.callback.TransactionCallback;
import org.fisco.bcos.sdk.transaction.model.exception.ContractException;

@SuppressWarnings("unchecked")
public class SuppleChain extends Contract {
    public static final String[] BINARY_ARRAY = {"60806040523480156200001157600080fd5b506200002b62000031640100000000026401000000009004565b620005cb565b600061100190508073ffffffffffffffffffffffffffffffffffffffff166356004b6a6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018060200180602001848103845260068152602001807f745f736565640000000000000000000000000000000000000000000000000000815250602001848103835260088152602001807f736565644e616d65000000000000000000000000000000000000000000000000815250602001848103825260148152602001807f6f726967696e2c7175616c6966792c6272616e640000000000000000000000008152506020019350505050602060405180830381600087803b1580156200014b57600080fd5b505af115801562000160573d6000803e3d6000fd5b505050506040513d60208110156200017757600080fd5b8101908080519060200190929190505050508073ffffffffffffffffffffffffffffffffffffffff166356004b6a6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018060200180602001848103845260078152602001807f745f706c616e7400000000000000000000000000000000000000000000000000815250602001848103835260098152602001807f70726f6475637449640000000000000000000000000000000000000000000000815250602001848103825260228152602001807f736565644e616d652c656e74727954696d652c6f757454696d652c73706f6e7381526020017f6f720000000000000000000000000000000000000000000000000000000000008152506040019350505050602060405180830381600087803b158015620002c257600080fd5b505af1158015620002d7573d6000803e3d6000fd5b505050506040513d6020811015620002ee57600080fd5b8101908080519060200190929190505050508073ffffffffffffffffffffffffffffffffffffffff166356004b6a6040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018060200180602001848103845260098152602001807f745f636172726965720000000000000000000000000000000000000000000000815250602001848103835260098152602001807f70726f6475637449640000000000000000000000000000000000000000000000815250602001848103825260358152602001807f64656c69766572416464726573732c64656c6976657254696d652c726563656981526020017f766554696d652c726563656976654164647265737300000000000000000000008152506040019350505050602060405180830381600087803b1580156200043957600080fd5b505af11580156200044e573d6000803e3d6000fd5b505050506040513d60208110156200046557600080fd5b8101908080519060200190929190505050508073ffffffffffffffffffffffffffffffffffffffff166356004b6a6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001806020018481038452600a8152602001807f745f7465726d696e616c00000000000000000000000000000000000000000000815250602001848103835260098152602001807f70726f6475637449640000000000000000000000000000000000000000000000815250602001848103825260128152602001807f676f6f64734e616d652c73656c6c54696d6500000000000000000000000000008152506020019350505050602060405180830381600087803b1580156200058a57600080fd5b505af11580156200059f573d6000803e3d6000fd5b505050506040513d6020811015620005b657600080fd5b81019080805190602001909291905050505050565b6116f580620005db6000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806355ec7326146100515780638cbf3f551461027e575b600080fd5b34801561005d57600080fd5b506100b8600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506103cd565b6040518086815260200180602001806020018060200180602001858103855289818151815260200191508051906020019080838360005b8381101561010a5780820151818401526020810190506100ef565b50505050905090810190601f1680156101375780820380516001836020036101000a031916815260200191505b50858103845288818151815260200191508051906020019080838360005b83811015610170578082015181840152602081019050610155565b50505050905090810190601f16801561019d5780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b838110156101d65780820151818401526020810190506101bb565b50505050905090810190601f1680156102035780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b8381101561023c578082015181840152602081019050610221565b50505050905090810190601f1680156102695780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390f35b34801561028a57600080fd5b506103b7600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610ca8565b6040518082815260200191505060405180910390f35b600060608060608060008060006104186040805190810160405280600681526020017f745f7365656400000000000000000000000000000000000000000000000000008152506115a4565b92508273ffffffffffffffffffffffffffffffffffffffff1663e8434e398a8573ffffffffffffffffffffffffffffffffffffffff16637857d7c96040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561049b57600080fd5b505af11580156104af573d6000803e3d6000fd5b505050506040513d60208110156104c557600080fd5b81019080805190602001909291905050506040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b83811015610573578082015181840152602081019050610558565b50505050905090810190601f1680156105a05780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b1580156105c057600080fd5b505af11580156105d4573d6000803e3d6000fd5b505050506040513d60208110156105ea57600080fd5b810190808051906020019092919050505091508173ffffffffffffffffffffffffffffffffffffffff1663949d225d6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561066157600080fd5b505af1158015610675573d6000803e3d6000fd5b505050506040513d602081101561068b57600080fd5b81019080805190602001909291905050506000141561071b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809050602060405190810160405280600081525060206040519081016040528060008152506020604051908101604052806000815250602060405190810160405280600081525097509750975097509750610c9c565b8173ffffffffffffffffffffffffffffffffffffffff1663846719e060006040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561078b57600080fd5b505af115801561079f573d6000803e3d6000fd5b505050506040513d60208110156107b557600080fd5b8101908080519060200190929190505050905060008173ffffffffffffffffffffffffffffffffffffffff16639c981fcb6040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260088152602001807f736565644e616d65000000000000000000000000000000000000000000000000815250602001915050600060405180830381600087803b15801561086a57600080fd5b505af115801561087e573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156108a857600080fd5b8101908080516401000000008111156108c057600080fd5b828101905060208101848111156108d657600080fd5b81518560018202830111640100000000821117156108f357600080fd5b50509291905050508273ffffffffffffffffffffffffffffffffffffffff16639c981fcb6040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260068152602001807f6f726967696e0000000000000000000000000000000000000000000000000000815250602001915050600060405180830381600087803b15801561099b57600080fd5b505af11580156109af573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156109d957600080fd5b8101908080516401000000008111156109f157600080fd5b82810190506020810184811115610a0757600080fd5b8151856001820283011164010000000082111715610a2457600080fd5b","50509291905050508373ffffffffffffffffffffffffffffffffffffffff16639c981fcb6040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260078152602001807f7175616c69667900000000000000000000000000000000000000000000000000815250602001915050600060405180830381600087803b158015610acc57600080fd5b505af1158015610ae0573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506020811015610b0a57600080fd5b810190808051640100000000811115610b2257600080fd5b82810190506020810184811115610b3857600080fd5b8151856001820283011164010000000082111715610b5557600080fd5b50509291905050508473ffffffffffffffffffffffffffffffffffffffff16639c981fcb6040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260058152602001807f6272616e64000000000000000000000000000000000000000000000000000000815250602001915050600060405180830381600087803b158015610bfd57600080fd5b505af1158015610c11573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506020811015610c3b57600080fd5b810190808051640100000000811115610c5357600080fd5b82810190506020810184811115610c6957600080fd5b8151856001820283011164010000000082111715610c8657600080fd5b5050929190505050849450975097509750975097505b50505091939590929450565b6000806000806000806000945060009350610cf76040805190810160405280600681526020017f745f7365656400000000000000000000000000000000000000000000000000008152506115a4565b92508273ffffffffffffffffffffffffffffffffffffffff166313db93466040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610d5d57600080fd5b505af1158015610d71573d6000803e3d6000fd5b505050506040513d6020811015610d8757600080fd5b810190808051906020019092919050505091508173ffffffffffffffffffffffffffffffffffffffff1663e942b5168b6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260088152602001807f736565644e616d65000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b83811015610e5a578082015181840152602081019050610e3f565b50505050905090810190601f168015610e875780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015610ea757600080fd5b505af1158015610ebb573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff1663e942b5168a6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260068152602001807f6f726967696e0000000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b83811015610f7f578082015181840152602081019050610f64565b50505050905090810190601f168015610fac5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015610fcc57600080fd5b505af1158015610fe0573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff1663e942b516896040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f7175616c69667900000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b838110156110a4578082015181840152602081019050611089565b50505050905090810190601f1680156110d15780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b1580156110f157600080fd5b505af1158015611105573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff1663e942b516886040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260058152602001807f6272616e64000000000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b838110156111c95780820151818401526020810190506111ae565b50505050905090810190601f1680156111f65780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b15801561121657600080fd5b505af115801561122a573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff166331afac368b846040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b838110156112e95780820151818401526020810190506112ce565b50505050905090810190601f1680156113165780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b15801561133657600080fd5b505af115801561134a573d6000803e3d6000fd5b505050506040513d602081101561136057600080fd5b81019080805190602001909291905050509050600181141561138557600094506113a9565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff94505b7fa37973aea8eaeca81420af38a524891de9a1121c0a83778cdc85351f10909126858b8b8b8b6040518086815260200180602001806020018060200180602001858103855289818151815260200191508051906020019080838360005b83811015611421578082015181840152602081019050611406565b50505050905090810190601f16801561144e5780820380516001836020036101000a031916815260200191505b50858103845288818151815260200191508051906020019080838360005b8381101561148757808201518184015260208101905061146c565b50505050905090810190601f1680156114b45780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b838110156114ed5780820151818401526020810190506114d2565b50505050905090810190601f16801561151a5780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b83811015611553578082015181840152602081019050611538565b50505050905090810190601f1680156115805780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390a18495505050505050949350505050565b600080600061100191508173ffffffffffffffffffffffffffffffffffffffff1663f23f63c9856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561163657808201518184015260208101905061161b565b50505050905090810190601f1680156116635780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b15801561168257600080fd5b505af1158015611696573d6000803e3d6000fd5b505050506040513d60208110156116ac57600080fd5b8101908080519060200190929190505050905080925050509190505600a165627a7a7230582001edd6671453507e7b21e08b3bd586c66a093f4e5687c307d7fa2b0cd27e2d2c0029"};

    public static final String BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", BINARY_ARRAY);

    public static final String[] SM_BINARY_ARRAY = {"60806040523480156200001157600080fd5b506200002b62000031640100000000026401000000009004565b620005cb565b600061100190508073ffffffffffffffffffffffffffffffffffffffff1663c92a78016040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018060200180602001848103845260068152602001807f745f736565640000000000000000000000000000000000000000000000000000815250602001848103835260088152602001807f736565644e616d65000000000000000000000000000000000000000000000000815250602001848103825260148152602001807f6f726967696e2c7175616c6966792c6272616e640000000000000000000000008152506020019350505050602060405180830381600087803b1580156200014b57600080fd5b505af115801562000160573d6000803e3d6000fd5b505050506040513d60208110156200017757600080fd5b8101908080519060200190929190505050508073ffffffffffffffffffffffffffffffffffffffff1663c92a78016040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018060200180602001848103845260078152602001807f745f706c616e7400000000000000000000000000000000000000000000000000815250602001848103835260098152602001807f70726f6475637449640000000000000000000000000000000000000000000000815250602001848103825260228152602001807f736565644e616d652c656e74727954696d652c6f757454696d652c73706f6e7381526020017f6f720000000000000000000000000000000000000000000000000000000000008152506040019350505050602060405180830381600087803b158015620002c257600080fd5b505af1158015620002d7573d6000803e3d6000fd5b505050506040513d6020811015620002ee57600080fd5b8101908080519060200190929190505050508073ffffffffffffffffffffffffffffffffffffffff1663c92a78016040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018060200180602001848103845260098152602001807f745f636172726965720000000000000000000000000000000000000000000000815250602001848103835260098152602001807f70726f6475637449640000000000000000000000000000000000000000000000815250602001848103825260358152602001807f64656c69766572416464726573732c64656c6976657254696d652c726563656981526020017f766554696d652c726563656976654164647265737300000000000000000000008152506040019350505050602060405180830381600087803b1580156200043957600080fd5b505af11580156200044e573d6000803e3d6000fd5b505050506040513d60208110156200046557600080fd5b8101908080519060200190929190505050508073ffffffffffffffffffffffffffffffffffffffff1663c92a78016040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001806020018481038452600a8152602001807f745f7465726d696e616c00000000000000000000000000000000000000000000815250602001848103835260098152602001807f70726f6475637449640000000000000000000000000000000000000000000000815250602001848103825260128152602001807f676f6f64734e616d652c73656c6c54696d6500000000000000000000000000008152506020019350505050602060405180830381600087803b1580156200058a57600080fd5b505af11580156200059f573d6000803e3d6000fd5b505050506040513d6020811015620005b657600080fd5b81019080805190602001909291905050505050565b6116f580620005db6000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806378f3fe8d14610051578063f89023fc1461027e575b600080fd5b34801561005d57600080fd5b506100b8600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506103cd565b6040518086815260200180602001806020018060200180602001858103855289818151815260200191508051906020019080838360005b8381101561010a5780820151818401526020810190506100ef565b50505050905090810190601f1680156101375780820380516001836020036101000a031916815260200191505b50858103845288818151815260200191508051906020019080838360005b83811015610170578082015181840152602081019050610155565b50505050905090810190601f16801561019d5780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b838110156101d65780820151818401526020810190506101bb565b50505050905090810190601f1680156102035780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b8381101561023c578082015181840152602081019050610221565b50505050905090810190601f1680156102695780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390f35b34801561028a57600080fd5b506103b7600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610ca8565b6040518082815260200191505060405180910390f35b600060608060608060008060006104186040805190810160405280600681526020017f745f7365656400000000000000000000000000000000000000000000000000008152506115a4565b92508273ffffffffffffffffffffffffffffffffffffffff1663d8ac59578a8573ffffffffffffffffffffffffffffffffffffffff1663c74f8caf6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561049b57600080fd5b505af11580156104af573d6000803e3d6000fd5b505050506040513d60208110156104c557600080fd5b81019080805190602001909291905050506040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b83811015610573578082015181840152602081019050610558565b50505050905090810190601f1680156105a05780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b1580156105c057600080fd5b505af11580156105d4573d6000803e3d6000fd5b505050506040513d60208110156105ea57600080fd5b810190808051906020019092919050505091508173ffffffffffffffffffffffffffffffffffffffff1663d3e9af5a6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561066157600080fd5b505af1158015610675573d6000803e3d6000fd5b505050506040513d602081101561068b57600080fd5b81019080805190602001909291905050506000141561071b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff809050602060405190810160405280600081525060206040519081016040528060008152506020604051908101604052806000815250602060405190810160405280600081525097509750975097509750610c9c565b8173ffffffffffffffffffffffffffffffffffffffff16633dd2b61460006040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561078b57600080fd5b505af115801561079f573d6000803e3d6000fd5b505050506040513d60208110156107b557600080fd5b8101908080519060200190929190505050905060008173ffffffffffffffffffffffffffffffffffffffff16639bca41e86040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260088152602001807f736565644e616d65000000000000000000000000000000000000000000000000815250602001915050600060405180830381600087803b15801561086a57600080fd5b505af115801561087e573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156108a857600080fd5b8101908080516401000000008111156108c057600080fd5b828101905060208101848111156108d657600080fd5b81518560018202830111640100000000821117156108f357600080fd5b50509291905050508273ffffffffffffffffffffffffffffffffffffffff16639bca41e86040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260068152602001807f6f726967696e0000000000000000000000000000000000000000000000000000815250602001915050600060405180830381600087803b15801561099b57600080fd5b505af11580156109af573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156109d957600080fd5b8101908080516401000000008111156109f157600080fd5b82810190506020810184811115610a0757600080fd5b8151856001820283011164010000000082111715610a2457600080fd5b","50509291905050508373ffffffffffffffffffffffffffffffffffffffff16639bca41e86040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260078152602001807f7175616c69667900000000000000000000000000000000000000000000000000815250602001915050600060405180830381600087803b158015610acc57600080fd5b505af1158015610ae0573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506020811015610b0a57600080fd5b810190808051640100000000811115610b2257600080fd5b82810190506020810184811115610b3857600080fd5b8151856001820283011164010000000082111715610b5557600080fd5b50509291905050508473ffffffffffffffffffffffffffffffffffffffff16639bca41e86040518163ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825260058152602001807f6272616e64000000000000000000000000000000000000000000000000000000815250602001915050600060405180830381600087803b158015610bfd57600080fd5b505af1158015610c11573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506020811015610c3b57600080fd5b810190808051640100000000811115610c5357600080fd5b82810190506020810184811115610c6957600080fd5b8151856001820283011164010000000082111715610c8657600080fd5b5050929190505050849450975097509750975097505b50505091939590929450565b6000806000806000806000945060009350610cf76040805190810160405280600681526020017f745f7365656400000000000000000000000000000000000000000000000000008152506115a4565b92508273ffffffffffffffffffffffffffffffffffffffff16635887ab246040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610d5d57600080fd5b505af1158015610d71573d6000803e3d6000fd5b505050506040513d6020811015610d8757600080fd5b810190808051906020019092919050505091508173ffffffffffffffffffffffffffffffffffffffff16631a391cb48b6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260088152602001807f736565644e616d65000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b83811015610e5a578082015181840152602081019050610e3f565b50505050905090810190601f168015610e875780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015610ea757600080fd5b505af1158015610ebb573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff16631a391cb48a6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260068152602001807f6f726967696e0000000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b83811015610f7f578082015181840152602081019050610f64565b50505050905090810190601f168015610fac5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015610fcc57600080fd5b505af1158015610fe0573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff16631a391cb4896040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260078152602001807f7175616c69667900000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b838110156110a4578082015181840152602081019050611089565b50505050905090810190601f1680156110d15780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b1580156110f157600080fd5b505af1158015611105573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff16631a391cb4886040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835260058152602001807f6272616e64000000000000000000000000000000000000000000000000000000815250602001838103825284818151815260200191508051906020019080838360005b838110156111c95780820151818401526020810190506111ae565b50505050905090810190601f1680156111f65780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b15801561121657600080fd5b505af115801561122a573d6000803e3d6000fd5b505050508273ffffffffffffffffffffffffffffffffffffffff16634c6f30c08b846040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b838110156112e95780820151818401526020810190506112ce565b50505050905090810190601f1680156113165780820380516001836020036101000a031916815260200191505b509350505050602060405180830381600087803b15801561133657600080fd5b505af115801561134a573d6000803e3d6000fd5b505050506040513d602081101561136057600080fd5b81019080805190602001909291905050509050600181141561138557600094506113a9565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff94505b7f18567da93db77d63b03e4ad4ccd93a66579e21346141cffb5e536f99763138d5858b8b8b8b6040518086815260200180602001806020018060200180602001858103855289818151815260200191508051906020019080838360005b83811015611421578082015181840152602081019050611406565b50505050905090810190601f16801561144e5780820380516001836020036101000a031916815260200191505b50858103845288818151815260200191508051906020019080838360005b8381101561148757808201518184015260208101905061146c565b50505050905090810190601f1680156114b45780820380516001836020036101000a031916815260200191505b50858103835287818151815260200191508051906020019080838360005b838110156114ed5780820151818401526020810190506114d2565b50505050905090810190601f16801561151a5780820380516001836020036101000a031916815260200191505b50858103825286818151815260200191508051906020019080838360005b83811015611553578082015181840152602081019050611538565b50505050905090810190601f1680156115805780820380516001836020036101000a031916815260200191505b50995050505050505050505060405180910390a18495505050505050949350505050565b600080600061100191508173ffffffffffffffffffffffffffffffffffffffff166359a48b65856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561163657808201518184015260208101905061161b565b50505050905090810190601f1680156116635780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b15801561168257600080fd5b505af1158015611696573d6000803e3d6000fd5b505050506040513d60208110156116ac57600080fd5b8101908080519060200190929190505050905080925050509190505600a165627a7a72305820cd7658061262d78098df0b7739416d75a9faf0328dc4c451a68c6920a4db5e3f0029"};

    public static final String SM_BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", SM_BINARY_ARRAY);

    public static final String[] ABI_ARRAY = {"[{\"constant\":true,\"inputs\":[{\"name\":\"seedName\",\"type\":\"string\"}],\"name\":\"selectSeed\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"},{\"name\":\"\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"string\"},{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"seedName\",\"type\":\"string\"},{\"name\":\"origin\",\"type\":\"string\"},{\"name\":\"qualify\",\"type\":\"string\"},{\"name\":\"brand\",\"type\":\"string\"}],\"name\":\"insertSeed\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"ret\",\"type\":\"int256\"},{\"indexed\":false,\"name\":\"seedName\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"origin\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"qualify\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"brand\",\"type\":\"string\"}],\"name\":\"InsertSeedEvent\",\"type\":\"event\"}]"};

    public static final String ABI = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", ABI_ARRAY);

    public static final String FUNC_SELECTSEED = "selectSeed";

    public static final String FUNC_INSERTSEED = "insertSeed";

    public static final Event INSERTSEEDEVENT_EVENT = new Event("InsertSeedEvent", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
    ;

    protected SuppleChain(String contractAddress, Client client, CryptoKeyPair credential) {
        super(getBinary(client.getCryptoSuite()), contractAddress, client, credential);
    }

    public static String getBinary(CryptoSuite cryptoSuite) {
        return (cryptoSuite.getCryptoTypeConfig() == CryptoType.ECDSA_TYPE ? BINARY : SM_BINARY);
    }

    public Tuple5<BigInteger, String, String, String, String> selectSeed(String seedName) throws ContractException {
        final Function function = new Function(FUNC_SELECTSEED, 
                Arrays.<Type>asList(new Utf8String(seedName)),
                Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = executeCallWithMultipleValueReturn(function);
        return new Tuple5<BigInteger, String, String, String, String>(
                (BigInteger) results.get(0).getValue(), 
                (String) results.get(1).getValue(), 
                (String) results.get(2).getValue(), 
                (String) results.get(3).getValue(), 
                (String) results.get(4).getValue());
    }

    public TransactionReceipt insertSeed(String seedName, String origin, String qualify, String brand) {
        final Function function = new Function(
                FUNC_INSERTSEED, 
                Arrays.<Type>asList(new Utf8String(seedName),
                new Utf8String(origin),
                new Utf8String(qualify),
                new Utf8String(brand)),
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void insertSeed(String seedName, String origin, String qualify, String brand, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_INSERTSEED, 
                Arrays.<Type>asList(new Utf8String(seedName),
                new Utf8String(origin),
                new Utf8String(qualify),
                new Utf8String(brand)),
                Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForInsertSeed(String seedName, String origin, String qualify, String brand) {
        final Function function = new Function(
                FUNC_INSERTSEED, 
                Arrays.<Type>asList(new Utf8String(seedName),
                new Utf8String(origin),
                new Utf8String(qualify),
                new Utf8String(brand)),
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple4<String, String, String, String> getInsertSeedInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_INSERTSEED, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple4<String, String, String, String>(

                (String) results.get(0).getValue(), 
                (String) results.get(1).getValue(), 
                (String) results.get(2).getValue(), 
                (String) results.get(3).getValue()
                );
    }

    public Tuple1<BigInteger> getInsertSeedOutput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getOutput();
        final Function function = new Function(FUNC_INSERTSEED, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<BigInteger>(

                (BigInteger) results.get(0).getValue()
                );
    }

    public List<InsertSeedEventEventResponse> getInsertSeedEventEvents(TransactionReceipt transactionReceipt) {
        List<EventValuesWithLog> valueList = extractEventParametersWithLog(INSERTSEEDEVENT_EVENT, transactionReceipt);
        ArrayList<InsertSeedEventEventResponse> responses = new ArrayList<InsertSeedEventEventResponse>(valueList.size());
        for (EventValuesWithLog eventValues : valueList) {
            InsertSeedEventEventResponse typedResponse = new InsertSeedEventEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.ret = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            typedResponse.seedName = (String) eventValues.getNonIndexedValues().get(1).getValue();
            typedResponse.origin = (String) eventValues.getNonIndexedValues().get(2).getValue();
            typedResponse.qualify = (String) eventValues.getNonIndexedValues().get(3).getValue();
            typedResponse.brand = (String) eventValues.getNonIndexedValues().get(4).getValue();
            responses.add(typedResponse);
        }
        return responses;
    }

    public void subscribeInsertSeedEventEvent(String fromBlock, String toBlock, List<String> otherTopics, EventCallback callback) {
        String topic0 = eventEncoder.encode(INSERTSEEDEVENT_EVENT);
        subscribeEvent(ABI,BINARY,topic0,fromBlock,toBlock,otherTopics,callback);
    }

    public void subscribeInsertSeedEventEvent(EventCallback callback) {
        String topic0 = eventEncoder.encode(INSERTSEEDEVENT_EVENT);
        subscribeEvent(ABI,BINARY,topic0,callback);
    }

    public static SuppleChain load(String contractAddress, Client client, CryptoKeyPair credential) {
        return new SuppleChain(contractAddress, client, credential);
    }

    public static SuppleChain deploy(Client client, CryptoKeyPair credential) throws ContractException {
        return deploy(SuppleChain.class, client, credential, getBinary(client.getCryptoSuite()), "");
    }

    public static class InsertSeedEventEventResponse {
        public TransactionReceipt.Logs log;

        public BigInteger ret;

        public String seedName;

        public String origin;

        public String qualify;

        public String brand;
    }
}
